package com.qcby.shujia.demo.controller;

import com.qcby.shujia.demo.entity.Role;
import com.qcby.shujia.demo.entity.User;
import com.qcby.shujia.demo.entity.vo.RoleVo;
import com.qcby.shujia.demo.entity.vo.UserVo;
import com.qcby.shujia.demo.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @className: RoleController
 * @description: TODO 类描述
 * @author: whz
 * @date: 2021/9/20
 **/
@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @RequestMapping("/insert")
    public int insert(Role role,@RequestParam List<Integer> rightids){
        int i=roleService.insert(role,rightids);
        return i;
    }
    @RequestMapping("/delete")
    public int delete(Integer id){
        int i=roleService.deleteById(id);
        return i;
    }
    @RequestMapping("/selectAll")
    public List<Role> selectAll(){
        List<Role> li= roleService.selectAll();
        return li;
    }
    @RequestMapping("/selectRrById")
    public RoleVo selectRrById(Integer id){
        RoleVo roleVo = roleService.selectRrById(id);
        return  roleVo;
    }
    @RequestMapping("/deletedisp")
    public int deletedisp(int[] ids){
        int i=roleService.deletedisp(ids);
        return i;
    }
    @RequestMapping("/update")
    public int update(Role role,@RequestParam List<Integer> uprightids){
        int i= roleService.update(role,uprightids);
        return i;
    }
}
